#!/bin/bash

# download link: https://github.com/nushell/nushell/releases/download/0.97.1/nu-0.97.1-x86_64-unknown-linux-gnu.tar.gz

version="0.97.1"

url="https://github.com/nushell/nushell/releases/download/${version}/nu-${version}-x86_64-unknown-linux-gnu.tar.gz"

mkdir ~/nushell-install
cd ~/nushell-install

curl -LO ${url}

tar -zxvf nu-*.tar.gz
rm nu-*.tar.gz

mv nu-* /opt/nu

ln -s /opt/nu/nu /usr/bin/nu

chsh

nu

echo "" >> ~/.config/nushell/config.nu
echo "alias proxy = load-env { \"http_proxy\": \"127.0.0.1:7897\", \"https_proxy\": \"127.0.0.1:7897\" }" >> ~/.config/nushell/config.nu
echo "alias unproxy = load-env { \"http_proxy\": \"\", \"https_proxy\": \"\" }" >> ~/.config/nushell/config.nu